//
//  AXHomeNcpscFiveCollectionCell.m
//  AnXin100
//
//  Created by 天质弘耕 on 2018/10/23.
//  Copyright © 2018年 tzhg. All rights reserved.
//

#import "AXHomeNcpscFiveCollectionCell.h"
#import "UIView+SDAutoLayout.h"
#import "ZXCategories.h"

@implementation AXHomeNcpscFiveCollectionCell

- (id)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        
        [self creatView];
        [self setlayout];
        
      
    }
    return self;
}

- (void)creatView {
    
    self.bgView = [[UIView alloc]init];
    self.bgView.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:self.bgView];
    
    /** imageview */
    self.storeImageView = [[UIImageView alloc]init];
    self.storeImageView.backgroundColor = [UIColor clearColor];
    self.storeImageView.image = [UIImage imageNamed:@"tmxy"];
    self.storeImageView.contentMode =UIViewContentModeScaleAspectFill;
    self.storeImageView.clipsToBounds = YES;
    [self.bgView addSubview:self.storeImageView];
    
    /** title */
    self.storeNameLabel = [[UILabel alloc]init];
    self.storeNameLabel.font = FONT_TWELVE;
    self.storeNameLabel.text = @"云南四级草莓";
    self.storeNameLabel.textColor = COLOR_ORG;
    self.storeNameLabel.textAlignment = NSTextAlignmentCenter;
    [self.bgView  addSubview:self.storeNameLabel];
    
    /** 价格 */
    self.priceLabel = [[UILabel alloc]init];
    self.priceLabel.textAlignment = NSTextAlignmentCenter;
    self.priceLabel.font =  FONT_TWELVE;
    self.priceLabel.textColor = COLOR_ORG;
    self.priceLabel.text = @"¥444";
    [self.bgView  addSubview:self.priceLabel];
    
    self.shopButton = [[UIButton alloc]init];
    self.shopButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.shopButton.cornerRadius = 2;
    self.shopButton.titleLabel.font =  FONT_TWELVE;
    self.shopButton.backgroundColor = COLOR_ORG;
    [self.shopButton setTitle:@"甜蜜相约" forState:UIControlStateNormal];
    [self.shopButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [self.shopButton addTarget:self action:@selector(tapPraise:) forControlEvents:UIControlEventTouchUpInside];
    [self.bgView  addSubview:self.shopButton];
    
    
}

- (void)setlayout {
    
    self.bgView.sd_layout
    .leftSpaceToView(self.contentView, (SCREEN_WIDTH-204)/4.0)
    .topSpaceToView(self.contentView,10)
    .widthIs(87)
    .heightIs(110);
   
    /** 店铺图片 */
    self.storeImageView.sd_layout
    .centerXEqualToView(self.bgView)
    .topSpaceToView(self.bgView,0)
    .widthIs(50)
    .heightIs(50);
    
    /** 店铺名字 */
    self.storeNameLabel.sd_layout
    .centerXEqualToView(self.bgView)
    .topSpaceToView(self.storeImageView,0)
    .widthIs(80)
    .heightIs(20);
    
    /** 价格 */
    self.priceLabel.sd_layout
    .centerXEqualToView(self.bgView)
    .topSpaceToView(self.storeNameLabel,0)
    .widthIs(80)
    .heightIs(20);
    
    /** 购买*/
    self.shopButton.sd_layout
    .centerXEqualToView(self.bgView)
    .topSpaceToView(self.priceLabel,0)
    .widthIs(60)
    .heightIs(20);
    
}

- (void)tapPraise:(UIButton *)btn {
    
}

@end
